function foo(...args) {
  console.log(args);
  console.log(arguments);
  
}

foo(1,2,3,4)